public class Table {
    public static void main(String[] args) {
        int N=9;
        int i,j;
        int s[][];
        s=new int[N][N];
        System.out.print("*   |");
        for(i=1;i<=N;i++)
            System.out.printf("%5d",i);
        System.out.println("\n----|--------------------------------------------------");
        for(i=1;i<=N;i++)
            for(j=1;j<=i;j++)
                s[i-1][j-1]=i*j;
        for(i=1;i<=N;i++){
            System.out.print(i+"   |");
            for(j=1;j<=i;j++)
                System.out.printf("%5d",s[i-1][j-1]);
            System.out.print("\n");
        }
    }
}
